<template>
  <el-col :span="span">
    <el-form-item class="c-form-item" :label="label" :label-width="labelwidth" :prop="prop" :required="required">
      <slot></slot>
      <template slot="label" v-if="label===''">
        <slot name="label"></slot>
      </template>
    </el-form-item>
  </el-col>
</template>

<script>
export default {
  name: 'c-form-item',
  props: {
    labelwidth: {
      type: String,
      default: undefined
    },
    label: {
      type: String,
      default: ''
    },
    prop: {
      type: String,
      default: null
    },
    required: {
      type: Boolean,
      default: false
    },
    span: {
      type: Number,
      default: 8
    }
  }
}
</script>

<style scoped>
.c-form-item {
  margin: 0 0;
  margin-bottom: 8px;
  margin-top: 2px;
}
</style>